/*************************************************************************
	> File Name: main.cc
	> Author: Joker
	> Mail: mahongtao@foxmail.com 
	> Created Time: 2020-09-08 09:55:31
 ************************************************************************/

#include "Observer.h"
#include <iostream>
using std::cout;
using std::endl;

void test0(){
    Observer *pObserver1 = new ConcreateObserver;
    Observer *pObserver2 = new ConcreateObserver;

    Subject *pSubject = new ConcreateSubject;
    
    pSubject->Attach(pObserver1);
    pSubject->Attach(pObserver2);
    pSubject->SetState(4);
    pSubject->Notify();

    pSubject->Detach(pObserver1);
    pSubject->SetState(10);
    pSubject->Notify();

    delete pSubject;
}
 
int main(int argc,char *argv[])
{
    test0();
    return 0;
}
